/**
 * 全局访问路径
 */
var path = "http://127.0.0.1:8899/api/consumer/"
/**
 * 图片全局路径
 */
var imgs = "http://120.48.47.144:8899/images/";
/**
 * 页面全局路径
 */
var pathHtml = "http://127.0.0.1:8899/html/";
var spend=0;  //必要花费
var Insurance=0;   //商业保险
var total_cost=0;   //总费用
var car_model_id;  //车型id
var car_series_id;  //车系id
var seat_money="";   //交强险
var car_tax="";   //车船税
var vehicle_damage="";   //车损险
var scratch ="";   //车辆划痕险
var quota="";   //车辆划痕险额度
var Listing=500;   //上牌费
var san="";   //第三者责任险
var quota2="";   //第三者责任险额度
var car_driver="";   //车上人员责任险(司机)
var quota3="";   //车上人员责任险(司机)额度
var car_passenger="";   //车上人员责任险(乘客)
var quota4="";   //车上人员责任险(乘客)额度

$(function() {
	/* 根据token获取用户信息 */
	get_user_mess_and_token();
	//自己代码
	var url = location.search; //路径   location.search.substr(1).split('/').indexOf(1)
	var url_x_index = url.indexOf('/'); /* 斜杠下标 */
	var url_x_last_index = url.lastIndexOf('//'); /* 最后参数斜杠下标 */
	car_series_id= url.substring(url.indexOf('?')+1,(url_x_index != -1 ? url_x_index : url.length));  //获取第一个参数
	car_model_id=url.substring(url_x_index+1,(url_x_last_index != -1 ? url_x_last_index : url.length));  //获取第二个参数
	Lookbrand();
});

//目前购置税的计算方式是：汽车销售发票的价格÷1.13(增值税)乘购置税百分比10%=车辆购置税金额。
//交强险：6座以下的 交强险 第1年投保价格 950元。      6座以上的 交强险 第1年投保价格 1100元。
//车船税：(1.5T)==350   (2.0T)==400   (3.0T)==1600  4.0升以上汽车车船税征收标准为3600元至5400元。
//购买第三者责任险一年固定费用为1721元  5万=607  10万=877  15万=999  20万=1087  30万=1226  50万=1472    100万= 1917  200万=2133
//车上人员责任险(司机)：1千=4，5千=21，1万=42,2万=84,3万=126，5万=210，10万=420
//车上人员责任险(乘客)：1千=11，5千=54，1万=108,2万=216,3万=324，5万=540，10万=1080
//购买车辆划痕险的计算是：1.划痕险赔付限额一般是2000元或者5000元，可累计赔付，累计超过2000元，保险合同自动终止； 2.赔付额度2000元的，需要每年交划痕险400元； 3.赔付额度5000元//的，需要每年交划痕险570元； 4.赔付额度10000元的，需要每年交划痕险760元； 5.赔付额度20000元的，需要每年交划痕险1140元。
//车损险 车价46000*费率0.9%(0.009)+基础保费342=756元*70%(7折)=529.2

function shangPai(){
	Listing=$("#shangPais").val();
	var Listingss = /^\d+$/;
	var spender=/^\d+$/;
	if(Listingss.test(Listing)){
		$("#shangPais").attr("value",Listing);
		var x1=$("#shangPais").parent().parent().parent().children("div:eq(0)").children("span:eq(0)").children("input").val();
		var x2=$("#shangPais").parent().parent().parent().children("div:eq(1)").children("span:eq(0)").children("input").val();
		var x3=$("#shangPais").parent().parent().parent().children("div:eq(3)").children("span:eq(0)").children("input").val();
		if(spender.test(spend)){
			spend=parseInt(Listing)+parseInt(x1)+parseInt(x2)+parseInt(x3);  //算出必要消费
		$("#shangPais").parent().parent().parent().parent().parent().prev().children("span:eq(0)").children("span:eq(0)").val(spend);
		$("#shangPais").parent().parent().parent().parent().parent().prev().children("span:eq(0)").children("span:eq(0)").text(spend);
		//必要消费
		$("#shangPais").parent().parent().parent().parent().parent().parent().parent().prev().children("div:eq(1)").children("div:eq(0)").children("div").children("span:eq(2)").children("span:eq(1)").text(spend);
		//裸车价格
		var che=$("#shangPais").parent().parent().parent().parent().parent().parent().children("div:eq(1)").children("span:eq(0)").children("input").val();
		//商业保险
		Insurance=$("#shangPais").parent().parent().parent().parent().parent().next().children("span:eq(0)").children("input").val();
		total_cost=parseInt(spend)+parseInt(che)+parseInt(Insurance);  //总金额
		$("#shangPais").parent().parent().parent().parent().parent().parent().parent().prev().children("div:eq(1)").children("div:eq(0)").children("span").text(total_cost);
		}
		
	}
}

//车辆划痕险
function huaHen(element){
	quota = $(element).text();
	if(quota=="2000"){
		scratch=400;
	}else if(quota=="5000"){
		scratch=570;
	}else if(quota=="1万"){
		scratch=760;
	}else if(quota=="2万"){
		scratch=1140;
	}
	$(element).parent().parent().prev().children("span:eq(0)").children().attr("value",scratch);   //选中改变金额
	$(element).attr("class","form-radio form-common_radio__17syC checked");   //选中当前元素
	$(element).siblings().attr("class","form-radio form-common_radio__17syC");   //取消选中当前元素
	$(element).children().attr("class","form-common_radio-icon__2Y_6L DCD_Icon icon_select_radio");  //选中当前元素
	$(element).siblings().children().attr("class","form-common_radio-icon__2Y_6L");  //取消选中
}

//第三者责任险
function liability(element){
	quota2=$(element).text();
	if(quota2=="5万"){
		san=607;
	}else if(quota2=="10万"){
		san=877;
	}else if(quota2=="15万"){
		san=999;
	}else if(quota2=="20万"){
		san=1087;
	}else if(quota2=="30万"){
		san=1226;
	}else if(quota2=="50万"){
		san=1472;
	}else if(quota2=="100万"){
		san=1917;
	}else if(quota2=="200万"){
		san=2133;
	}
	$(element).parent().parent().prev().children("span:eq(0)").children().attr("value",san);   //选中改变金额
	$(element).attr("class","form-button form-common_button__1t6aZ active");   //选中当前元素
	$(element).siblings().attr("class","form-button form-common_button__1t6aZ");   //取消选中当前元素
}

//车上人员责任险(司机)
function driver(element){
	quota3=$(element).text();
	if(quota3=="1千"){
		car_driver=4;
	}else if(quota3=="5千"){
		car_driver=21;
	}else if(quota3=="1万"){
		car_driver=42;
	}else if(quota3=="2万"){
		car_driver=84;
	}else if(quota3=="3万"){
		car_driver=126;
	}else if(quota3=="5万"){
		car_driver=210;
	}else if(quota3=="10万"){
		car_driver=420;
	}
	$(element).parent().parent().prev().children("span:eq(0)").children().attr("value",car_driver);   //选中改变金额
	$(element).attr("class","form-button form-common_button__1t6aZ active");   //选中当前元素
	$(element).siblings().attr("class","form-button form-common_button__1t6aZ");   //取消选中当前元素
}

//车上人员责任险(乘客)
function passenger(element){
	quota4=$(element).text();
	if(quota4=="1千"){
		car_passenger=11;
	}else if(quota4=="5千"){
		car_passenger=54;
	}else if(quota4=="1万"){
		car_passenger=108;
	}else if(quota4=="2万"){
		car_passenger=216;
	}else if(quota4=="3万"){
		car_passenger=324;
	}else if(quota4=="5万"){
		car_passenger=540;
	}else if(quota4=="10万"){
		car_passenger=1080;
	}
	$(element).parent().parent().prev().children("span:eq(0)").children().attr("value",car_passenger);   //选中改变金额
	$(element).attr("class","form-button form-common_button__1t6aZ active");   //选中当前元素
	$(element).siblings().attr("class","form-button form-common_button__1t6aZ");   //取消选中当前元素的前后兄弟
}

//计算商业保险并且算出总金额
function moneyAll(element){
	var aa=$(element).children("div:eq(1)").children("span:eq(0)").children().val();
	var aa2=$(element).children("div:eq(3)").children("span:eq(0)").children().val();
	var aa3=$(element).children("div:eq(4)").children("span:eq(0)").children().val();
	var aa4=$(element).children("div:eq(6)").children("span:eq(0)").children().val();
	var aa5=$(element).children("div:eq(8)").children("span:eq(0)").children().val();
	Insurance=parseInt(aa)+parseInt(aa2)+parseInt(aa3)+parseInt(aa4)+parseInt(aa5);
	$(element).parent().parent().prev().children("span:eq(0)").children("input").attr("value",Insurance);
	$(element).parent().parent().prev().children("span:eq(0)").children("span").text(Insurance);
	var biyao=$(element).parent().parent().parent().parent().prev().children("div:eq(1)").children("div:eq(0)").children().children("span:eq(2)").children("span:eq(1)").text();
	$(element).parent().parent().parent().parent().prev().children("div:eq(1)").children("div:eq(0)").children().children("span:eq(4)").children("span:eq(1)").text(Insurance);
	var car_money=$(element).parent().parent().parent().parent().prev().children("div:eq(1)").children("div:eq(0)").children().children("span:eq(0)").children("span:eq(1)").text();
	//alert(car_money+" "+biyao+" "+Insurance);
	total_cost=parseInt(car_money)+parseInt(biyao)+parseInt(Insurance);
	//alert(total_cost);
	$(element).parent().parent().parent().parent().prev().children("div:eq(1)").children("div:eq(0)").children("span").text(total_cost);
}

function priceAll(){
	var aa=$("#baoxian").next().children("div:eq(0)").children("div:eq(0)").children("div:eq(1)").children("span:eq(0)").children().val();
	var aa2=$("#baoxian").next().children("div:eq(0)").children("div:eq(0)").children("div:eq(3)").children("span:eq(0)").children().val();
	var aa3=$("#baoxian").next().children("div:eq(0)").children("div:eq(0)").children("div:eq(4)").children("span:eq(0)").children().val();
	var aa4=$("#baoxian").next().children("div:eq(0)").children("div:eq(0)").children("div:eq(6)").children("span:eq(0)").children().val();
	var aa5=$("#baoxian").next().children("div:eq(0)").children("div:eq(0)").children("div:eq(8)").children("span:eq(0)").children().val();
	Insurance=parseInt(aa)+parseInt(aa2)+parseInt(aa3)+parseInt(aa4)+parseInt(aa5);
	var Insurancer = /^\d+$/;
	if(Insurancer.test(Insurance)){
		$("#baoxian").children("span:eq(0)").children("input").attr("value",Insurance);
		$("#baoxian").children("span:eq(0)").children("span").text(Insurance);
		var biyao=$("#baoxian").parent().children("div:eq(2)").children("span:eq(0)").children("span").text();
		$("#baoxian").parent().parent().prev().children("div:eq(1)").children("div:eq(0)").children().children("span:eq(4)").children("span:eq(1)").text(Insurance);
		var car_money=$("#baoxian").parent().parent().prev().children("div:eq(1)").children("div:eq(0)").children("div:eq(0)").children("span:eq(0)").children("span:eq(1)").text();
		total_cost=parseInt(car_money)+parseInt(biyao)+parseInt(Insurance);
		$("#baoxian").parent().parent().prev().children("div:eq(1)").children("div:eq(0)").children("span").text(total_cost);
	}
}

//根据车系id显示所有的车型
//解决mouseover,mouseout闪烁------mouseenter:移入 mouseleave:移出
function show_model_all(element){
	$(element).children("div:eq(1)").fadeIn();
	//clearInterval();
	$(element).mouseenter(function(){
		$(element).children("div:eq(1)").fadeIn();
	});
	$(element).mouseleave(function(){
		$(element).children("div:eq(1)").fadeOut();
	});
	//$(element).parent().parent().next().slideToggle();
	//$(element).parent().parent().next().toggle();
}

//根据车型id显示所有数据
function show_details(element){
	car_model_id=$(element).val();
	Lookbrand();
}

//onclick='show_details(this)'
//**************点击查看购车计算 **************************
function Lookbrand(){
	$.post(path+'Car_ModelController/select_car_purchase_calculation/'+car_series_id+"/"+car_model_id,function(data){
		var model="";
		if(car_model_id!=0){
		var Vehicle_and_vessel_tax =(data.purchase_calculation.car_model_engine).substring(0,3);   //车船税
		/* 判断交强险 */
		if(data.purchase_calculation.car_model_seat_count < 6){
			seat_money=950;
		}else if(data.purchase_calculation.car_model_seat_count>=6){
			seat_money=1100;
		}
		/* 判断车船税 */
		if(Vehicle_and_vessel_tax<=1.5){
			car_tax=350;
		}else if(Vehicle_and_vessel_tax<=2.0){
			car_tax=400;
		}else if(Vehicle_and_vessel_tax<=3.0){
			car_tax=1600;
		}else if(Vehicle_and_vessel_tax<=4.0){
			car_tax=3600;
		}else if(Vehicle_and_vessel_tax>4.0){
			car_tax=5400;
		}
		/*  */
		var car_model_distributer_price2=(data.purchase_calculation.car_model_distributer_price)+"00";
		var a =car_model_distributer_price2.replace(".","");  //裸车价格  
		var purchase_tax=Math.round((parseInt(a)/1.13*0.1));    //购置税  parseInt(Math.round(a/1.13*0.1))
		//var Listing=500;   //上牌费
		spend = parseInt(purchase_tax)+parseInt(Listing)+parseInt(seat_money)+parseInt(car_tax);    //必要花费
		vehicle_damage=Math.round((parseInt(a)*0.009+342)*0.7);   //车损险
		
		
		total_cost=parseInt(a)+parseInt(spend);   //总费用
		}else{
			spend="-";
		}
		model+="<div class='tw-col-span-30'>"+
				"<section class='summary_root__10HVt' style='background-image:url(//lf3-motor.dcarstatic.com/obj/motor-fe-static/motor/pc/_next/./static/images/full-payment@2x-eb7535f5938b9ee7a0d7..png)'>"+
					"<div style='display:inline-block;position:relative;z-index:0;width:250px;height:200px;left:35px;bottom:25px;' class='tw-flex-none'>"+
					"<noscript>"
					if(car_model_id==0){
						model+="<img src='//lf3-motor.dcarstatic.com/obj/motor-fe-static/motor/pc/_next/./static/images/car-bg-l-02ad4ac6eb756aa9e98d..png' "+
					" width='220' height='138' style='position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%;object-fit:cover' class='' />"
					}else{
						model+="<img src='"+imgs+data.purchase_calculation.car_series.car_series_images_url_1+"' "+
					" width='220' height='138' style='position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%;object-fit:cover' class='' />"
					}
					model+="</noscript>"
					if(car_model_id==0){
					model+="<img src='//lf3-motor.dcarstatic.com/obj/motor-fe-static/motor/pc/_next/./static/images/car-bg-l-02ad4ac6eb756aa9e98d..png' "+
						" width='220' height='138' style='position:absolute;top:0;left:-40;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%;object-fit:cover' class='' />"
					}else{
					model+="<img src='"+imgs+data.purchase_calculation.car_series.car_series_images_url_1+"' "+
					" width='220' height='138' style='position:absolute;top:0;left:-40;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%;object-fit:cover' class='' />"}
				model+="</div>"+
				"<div class='summary_price-wrapper__2KKic' style='margin:0 0 0 80px;'>"+
						"<h1 class='summary_price-title__3MzrY'>全款"+
							"<!-- -->购车总花费"+
						"</h1>"+
						"<div class='summary_price-detail__D-SoB summary_price-detail-fullpayment__238Et'>"+
							"<div class='tw-flex tw-items-center tw-content-between'>"+
								"<span class='summary_price-item__1vJCJ'>"+
									"<span class='summary_price-item-label__1MDnX'>裸车价格</span>"
								if(car_model_id==0){
									model+="<span class='summary_price-item-value__3JQ0V'>-</span>"
								}else{
									model+="<span class='summary_price-item-value__3JQ0V'>"+a+"</span>"
								}
								model+="</span>"+
								"<span class='summary_price-symbol__1Xbu0'>+</span>"+
								"<span class='summary_price-item__1vJCJ'>"+
									"<span class='summary_price-item-label__1MDnX'>必要花费</span>"+
									"<span class='summary_price-item-value__3JQ0V'>"+spend+"</span>"+
								"</span>"+
								"<span class='summary_price-symbol__1Xbu0'>+</span>"+
								"<span class='summary_price-item__1vJCJ'>"+
									"<span class='summary_price-item-label__1MDnX'>商业保险</span>"+
									"<span class='summary_price-item-value__3JQ0V'>-</span>"+
								"</span>"+
						"</div>"
						if(car_model_id==0){
							model+="<span class='summary_price-total__181dO'>-</span>"
						}else{
							model+="<span class='summary_price-total__181dO'>"+total_cost+"</span>"
						}
						model+="</div>"+
					"</div>"+
				"</section>"+
				"<section class='form_root__3goRC'>"+
					"<div class='form_tab__eBY7H'>"+
					 "<a class='form_tab-item__31n1b form_active__3g6se' href='javascript:void(0)'>全款</a>"+
					"</div>"+
					"<div class='form_container__1gsmK'>"+
						"<div class='form-item_root__2hMNy'>"+
							"<label class='form-item_label__3JrwI'>计算车型</label>"+
							"<div class='tw-relative car-model-select_input__3s5jh tw-cursor-pointer form_selector__1UTbZ' id='find_brand' onmouseover='show_model_all(this)'>"+
								"<div class='car-model-select_content__GMiDq line-2' >"+
									"<span class='brand-node'  >"
									if(car_model_id==0){
										model+="<span class='tw-text-gray-400'>-请选择车型-</span>"
									}else{
										model+="<span class='tw-text-gray-400'>"+data.purchase_calculation.car_model_name+"</span>"
									}
									model+= "<i class='DCD_Icon icon_triangle_down_12 car-model-select_gray-arrow__1GUML' ></i> "+
									"</span>"+
								"</div>"+
								"<div class='tool-tip_wrapper__1lKlz' "+
								   "style='display:none;z-index: 10200;position:absolute;inset:-360px auto auto -615px;transform:translate(779px, 392px);'"+
									" data-popper-reference-hidden='false' data-popper-escaped='false'"+
									" data-popper-placement='bottom-start'>"+
									"<div class='tool-tip_content__iv3CO light leave'>"+
										"<div class='tw-w-260 tw-overflow-auto g-cus-scroll-bar'"+
											" style='max-height: calc(50vh - 28px);'>"+
											"<ul >"
											$(data.modelList).each(function(index,item){
											model+="<li class='tw-cursor-pointer tw-flex tw-px-12 tw-leading-22 tw-py-8 hover:tw-bg-common-yellow hover:tw-bg-opacity-12' value='"+item.car_model_id+"' onclick='show_details(this)'>"+
													"<div class='tw-flex-1 tw-truncate' title='"+item.car_model_name+"' >"+item.car_model_name+" </div>"+
													"<div class='tw-ml-6 tw-font-semibold tw-text-color-red-500'>"+item.car_model_distributer_price+"万</div>"+
												"</li>"
											});	
											model+="</ul>"+
										"</div>"+
										"<div class='tool-tip_arrow__2t2cd light' style='display:none;position:absolute;left:0px;transform:translate(0px, 0px);'>"+
										"</div>"+
									"</div>"+
								"</div>"+
								
							"</div>"+
						"</div>"+
						"<div class='form-item_root__2hMNy tw-mt-24'>"+
							"<label class='form-item_label__3JrwI'>裸车价格</label>"+
							"<span class='form-item_input-wrapper__3wS2x'>"
								if(car_model_id==0){
									model+="<input type='number' class='form-item_input__1TLwD form-item_input-with-dash__QULg1' readonly='' value='0'/>"+
									"<span class='form-item_dash__jfY-q'>-</span>"
								}else{
									model+="<input type='number' class='form-item_input__1TLwD form-item_input-with-dash__QULg1' readonly='' value='"+a+"'/>"+
									"<span class='form-item_dash__jfY-q'>"+a+"</span>"
								}
							model+="</span>"+
							"<span class='form-item_unit__2yL7-'>元</span>"+
						"</div>"+
						"<div class='form-item_root__2hMNy tw-mt-24'>"+
							"<label class='form-item_label__3JrwI'>必要花费 </label>"+
							"<span class='form-item_input-wrapper__3wS2x'>"+
								"<input type='number' class='form-item_input__1TLwD form-item_input-with-dash__QULg1' readonly='' value='"+spend+"' />"+
								"<span class='form-item_dash__jfY-q'>"+spend+"</span>"+
							"</span>"+
							"<span class='form-item_unit__2yL7-'>元</span>"+
						"</div>"+
						"<div class='necessary-cost_root__2-tYP'>"+
						"<span class='necessary-cost_trigger__1pIVL' onclick='qiehuan2(this)'>查看详细购置税、交强险等费用"+
							"<i class='DCD_Icon icon_triangle_down_12'></i>"+
						"</span>"+

						"<div class='necessary-cost_root__2-tYP' style='margin: 4px 0 0 0;display:none;' >"+
							"<span class='necessary-cost_trigger__1pIVL' onclick='close_all(this)'>收起详情"+
								"<i class='DCD_Icon icon_triangle_up_12'></i>"+
							"</span>"+
							 "<div class='necessary-cost_detail__Th7Cf'>"+
								" <div class='form-item_root__2hMNy necessary-cost_detail-item__25gMI'>"+
									" <label class='form-item_label__3JrwI'>购置税</label>"+
									 "<span class='form-item_input-wrapper__3wS2x'>"+
										"<input class='form-item_input__1TLwD' type='number' readonly='' value='"+purchase_tax+"'></span>"+
									"<span class='form-item_unit__2yL7-'>元</span>"+
								"</div>"+
							" <div class='form-item_root__2hMNy necessary-cost_detail-item__25gMI'>"+
									"<label class='form-item_label__3JrwI' style='width: 100px;'>"+
										"<span class='tw-text-right tw-w-full'>"
									if(car_model_id==0){
										model+=	"<span class='necessary-cost_label-prepend__2rtKw'>(无座)</span>交强险</span>"
									}else{
										model+="<span class='necessary-cost_label-prepend__2rtKw'>("+data.purchase_calculation.car_model_seat_count+"座)</span>交强险</span>"
									}
									model+="</label>"+
									"<span class='form-item_input-wrapper__3wS2x'>"+
									"<input class='form-item_input__1TLwD' type='number' readonly='' value='"+seat_money+"' class='seat'></span>"+
									"<span class='form-item_unit__2yL7-'>元</span>"+
								"</div>"+
								"<div class='form-item_root__2hMNy necessary-cost_detail-item__25gMI'>"+
									"<label class='form-item_label__3JrwI'>上牌费</label>"+
									"<span class='form-item_input-wrapper__3wS2x'>"+
										"<input class='form-item_input__1TLwD' type='number' value='500' id='shangPais' onchange='shangPai()'></span>"+
										"<span class='form-item_unit__2yL7-'>元</span>"+
								"</div>"+
							"<div class='form-item_root__2hMNy necessary-cost_detail-item__25gMI'>"+
										"<label class='form-item_label__3JrwI' style='width: 100px;'>"+
											"<span class='tw-text-right tw-w-full'>"
											if(car_model_id==0){
												model+="<span class='necessary-cost_label-prepend__2rtKw'>(1.5T)</span>车船税"
											}else{
												model+="<span class='necessary-cost_label-prepend__2rtKw'>("+Vehicle_and_vessel_tax+"T)</span>车船税"
											}
											model+="</span>"+
										"</label>"+
										"<span class='form-item_input-wrapper__3wS2x'>"+
											"<input class='form-item_input__1TLwD' type='number' readonly='' value='"+car_tax+"'></span>"+
											"<span class='form-item_unit__2yL7-'>元</span>"+
								"</div>"+
							"</div>"+
							"</div>"+
						"</div>"+
						"<div class='form-item_root__2hMNy tw-mt-24' id='baoxian'>"+
							"<label class='form-item_label__3JrwI'>商业保险</label>"+
							"<span class='form-item_input-wrapper__3wS2x'>"+
							"<input type='number' class='form-item_input__1TLwD form-item_input-with-dash__QULg1' readonly='' value='0' />"+
							"<span class='form-item_dash__jfY-q'>-</span></span>"+
							"<span class='form-item_unit__2yL7-'>元</span>"+
						"</div>"+
						"<div class='insurance_root__MghxB'> "+
							"<span class='insurance_trigger__1pFfR' onclick='qiehuan2(this)'>查看第三者责任险、车辆损失险等费用"+
							"<i class='DCD_Icon icon_triangle_down_12'></i></span>"+

							"<div class='insurance_root__MghxB' style='margin: 4px 0 0 0;display:none;'>"+
							"<span class='insurance_trigger__1pFfR' onclick='close_all(this)'>收起详情"+
								"<i class='DCD_Icon icon_triangle_up_12'></i>"+
							"</span>"+
							"<div class='insurance_insurance__x0EuY' onclick='moneyAll(this)'>"+
									"<div class='insurance_type__1jVCR'>"+
										"<label class='insurance_type-label__3jirS'>推荐保险套餐</label>"+
										"<span class='insurance_type-button__28UwV active'>全险</span>"+
										/* "<span class='insurance_type-button__28UwV'>自定义</span>"+  http://127.0.0.1:8899/html/car_purchase_calculation.html?1/1*/
									"</div>"+
									"<div class='form-item_root__2hMNy insurance_item__1pA0O'>"+
										"<label class='form-item_label__3JrwI' style='width: 130px;'>"+
											"<span class='form-checkbox form-common_checkbox__67Jkt DCD_Icon icon_select_radio checked'></span>"+
											"<span class='insurance_label-text__13N5O'>第三者责任险</span>"+
										"</label>"+
										"<span class='form-item_input-wrapper__3wS2x'>"+
										"<input class='form-item_input__1TLwD' type='number' readonly='' value='1087'></span>"+
										"<span class='form-item_unit__2yL7-'>元</span>"+
									"</div>"+
									"<div class='insurance_append__3k_xH'>"+
										"<label class='insurance_append-label__2oAyT'>赔付额度</label>"+
										"<div class='insurance_append-group__1PUx5'>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='liability(this)' id='pei'>5万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='liability(this)' id='pei'>10万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='liability(this)' id='pei'>15万</span>"+
											"<span class='form-button form-common_button__1t6aZ active' onclick='liability(this)' id='pei'>20万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='liability(this)' id='pei'>30万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='liability(this)' id='pei'>50万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='liability(this)' id='pei'>100万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='liability(this)' id='pei'>200万</span>"+
										"</div>"+
									"</div>"+
									"<div class='form-item_root__2hMNy insurance_item__1pA0O'>"+
										"<label class='form-item_label__3JrwI' style='width: 130px;'>"+
											"<span class='form-checkbox form-common_checkbox__67Jkt DCD_Icon icon_select_radio checked'></span>"+
											"<span class='insurance_label-text__13N5O'>车辆损失险</span>"+
										"</label>"+
										"<span class='form-item_input-wrapper__3wS2x'>"+
										"<input class='form-item_input__1TLwD' type='number' readonly='' value='"+vehicle_damage+"'></span>"+
										"<span class='form-item_unit__2yL7-'>元</span>"+
									"</div>"+
									"<div class='form-item_root__2hMNy insurance_item__1pA0O'>"+
										"<label class='form-item_label__3JrwI' style='width: 130px;'>"+
											"<span class='form-checkbox form-common_checkbox__67Jkt DCD_Icon icon_select_radio checked'></span>"+
											"<span class='insurance_label-text__13N5O'>车上人员责任险(司机)</span>"+
										"</label>"+
										"<span class='form-item_input-wrapper__3wS2x'>"+
										"<input class='form-item_input__1TLwD' type='number' readonly='' value='42'></span>"+
										"<span class='form-item_unit__2yL7-'>元</span></div>"+
									"<div class='insurance_append__3k_xH'>"+
										"<label class='insurance_append-label__2oAyT'>投保额度</label>"+
										"<div class='insurance_append-group__1PUx5'>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='driver(this)'>1千</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='driver(this)'>5千</span>"+
											"<span class='form-button form-common_button__1t6aZ active' onclick='driver(this)'>1万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='driver(this)'>2万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='driver(this)'>3万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='driver(this)'>5万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='driver(this)'>10万</span>"+
										"</div>"+
									"</div>"+
									"<div class='form-item_root__2hMNy insurance_item__1pA0O'>"+
										"<label class='form-item_label__3JrwI' style='width: 130px;'>"+
											"<span class='form-checkbox form-common_checkbox__67Jkt DCD_Icon icon_select_radio checked'></span>"+
											"<span class='insurance_label-text__13N5O'>车上人员责任险(乘客)</span>"+
										"</label>"+
										"<span class='form-item_input-wrapper__3wS2x'>"+
										"<input class='form-item_input__1TLwD' type='number' readonly='' value='108'></span>"+
										"<span class='form-item_unit__2yL7-'>元</span></div>"+
									"<div class='insurance_append__3k_xH'>"+
										"<label class='insurance_append-label__2oAyT'>投保额度</label>"+
										"<div class='insurance_append-group__1PUx5'>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='passenger(this)'>1千</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='passenger(this)'>5千</span>"+
											"<span class='form-button form-common_button__1t6aZ active' onclick='passenger(this)'>1万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='passenger(this)'>2万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='passenger(this)'>3万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='passenger(this)'>5万</span>"+
											"<span class='form-button form-common_button__1t6aZ' onclick='passenger(this)'>10万</span>"+
										"</div>"+
									"</div>"+
									"<div class='form-item_root__2hMNy insurance_item__1pA0O'>"+
									"<label class='form-item_label__3JrwI' style='width: 130px;'>"+
										"<span class='form-checkbox form-common_checkbox__67Jkt DCD_Icon icon_select_radio checked'></span>"+
										"<span class='insurance_label-text__13N5O'>车身划痕险</span>"+
									"</label>"+
									"<span class='form-item_input-wrapper__3wS2x'>"+
										"<input class='form-item_input__1TLwD' type='number' readonly='' value='570'></span>"+
										"<span class='form-item_unit__2yL7-'>元</span></div>"+
									"<div class='insurance_append__3k_xH'>"+
										"<label class='insurance_append-label__2oAyT'>赔付额度</label>"+
										"<div class='insurance_append-group__1PUx5' >"+
											"<span class='form-radio form-common_radio__17syC' onclick='huaHen(this)'>"+
											"<span class='form-common_radio-icon__2Y_6L'></span>2000</span>"+
											"<span class='form-radio form-common_radio__17syC checked' onclick='huaHen(this)'>"+
											"<span class='form-common_radio-icon__2Y_6L DCD_Icon icon_select_radio'></span>5000</span>"+
											"<span class='form-radio form-common_radio__17syC' onclick='huaHen(this)'>"+
											"<span class='form-common_radio-icon__2Y_6L'></span>1万</span>"+
											"<span class='form-radio form-common_radio__17syC' onclick='huaHen(this)'>"+
											"<span class='form-common_radio-icon__2Y_6L'></span>2万</span>"+
										"</div>"+
									"</div>"+
								"</div>"+
							"</div>"+
						"</div>"+

					"</div>"+
					"<p class='form_tips__16wxk'>此结果仅供参考，实际费用以当地为准</p>"+
				"</section>"+
			"</div>"
		$("#Car_Buying section").remove();
		$("#Car_Buying").append(model);
		priceAll();
		shangPai();
	},"json");
	
}

function gou(){
	if($("#xieyi").children("span:eq(0)").attr("class")=="form-checkbox form-common_checkbox__67Jkt DCD_Icon icon_select_radio checked"){
		$("#xieyi").children("span:eq(0)").attr("class","form-checkbox form-common_checkbox__67Jkt");
		$("#xieyi").parent().prev().children("span:eq(0)").attr("class","insurance_type-button__28UwV");
		$("#xieyi").parent().prev().children("span:eq(1)").attr("class","insurance_type-button__28UwV active");
		$("#xieyi").next().children("input").attr("class","form-item_input__1TLwD form-item_input-with-dash__QULg1");
		$("#xieyi").next().children("input").val("0");
		var str="<span class='form-item_dash__jfY-q'>-</span>";
		$("#xieyi").next().append(str);
		
	}else{
		$("#xieyi").children("span:eq(0)").attr("class","form-checkbox form-common_checkbox__67Jkt DCD_Icon icon_select_radio checked");
		$("#xieyi").parent().prev().children("span:eq(0)").attr("class","insurance_type-button__28UwV active");
		$("#xieyi").parent().prev().children("span:eq(1)").attr("class","insurance_type-button__28UwV");
		if($("#xieyi").parent().next().children("div").children("span:eq(0)").text()=="5万" && $("#xieyi").parent().next().children("div").children("span:eq(0)").attr("class")=="form-button form-common_button__1t6aZ active"){
			san=607;
		}else if($("#xieyi").parent().next().children("div").children("span:eq(1)").text()=="10万" && $("#xieyi").parent().next().children("div").children("span:eq(1)").attr("class")=="form-button form-common_button__1t6aZ active"){
			san=877;
		}else if($("#xieyi").parent().next().children("div").children("span:eq(2)").text()=="15万" && $("#xieyi").parent().next().children("div").children("span:eq(2)").attr("class")=="form-button form-common_button__1t6aZ active"){
			san=999;
		}else if($("#xieyi").parent().next().children("div").children("span:eq(3)").text()=="20万" && $("#xieyi").parent().next().children("div").children("span:eq(3)").attr("class")=="form-button form-common_button__1t6aZ active"){
			san=1087;
		}else if($("#xieyi").parent().next().children("div").children("span:eq(4)").text()=="30万" && $("#xieyi").parent().next().children("div").children("span:eq(4)").attr("class")=="form-button form-common_button__1t6aZ active"){
			san=1226;
		}else if($("#xieyi").parent().next().children("div").children("span:eq(5)").text()=="50万" && $("#xieyi").parent().next().children("div").children("span:eq(5)").attr("class")=="form-button form-common_button__1t6aZ active"){
			san=1472;
		}else if($("#xieyi").parent().next().children("div").children("span:eq(6)").text()=="100万" && $("#xieyi").parent().next().children("div").children("span:eq(6)").attr("class")=="form-button form-common_button__1t6aZ active"){
			san=1917;
		}else if($("#xieyi").parent().next().children("div").children("span:eq(7)").text()=="200万" && $("#xieyi").parent().next().children("div").children("span:eq(7)").attr("class")=="form-button form-common_button__1t6aZ active"){
			san=2133;
		}
		// if($("#xieyi").parent().next().children("div").children("span:eq(0)").attr("class")=="form-button form-common_button__1t6aZ active"){
		// 	san=607;
		// }else if($("#xieyi").parent().next().children("div").children("span:eq(1)").attr("class")=="form-button form-common_button__1t6aZ active"){
		// 	san=877;
		// }else if($("#xieyi").parent().next().children("div").children("span:eq(2)").attr("class")=="form-button form-common_button__1t6aZ active"){
		// 	san=999;
		// }else if($("#xieyi").parent().next().children("div").children("span:eq(3)").attr("class")=="form-button form-common_button__1t6aZ active"){
		// 	san=1087;
		// }else if($("#xieyi").parent().next().children("div").children("span:eq(4)").attr("class")=="form-button form-common_button__1t6aZ active"){
		// 	san=1226;
		// }else if($("#xieyi").parent().next().children("div").children("span:eq(5)").attr("class")=="form-button form-common_button__1t6aZ active"){
		// 	san=1472;
		// }else if($("#xieyi").parent().next().children("div").children("span:eq(6)").attr("class")=="form-button form-common_button__1t6aZ active"){
		// 	san=1917;
		// }else if($("#xieyi").parent().next().children("div").children("span:eq(7)").attr("class")=="form-button form-common_button__1t6aZ active"){
		// 	san=2133;
		// }
		// if($("#pei").text()=="5万"){
		// 	san=607;
		// }else if($("#pei").text()=="10万"){
		// 	san=877;
		// }else if($("#pei").text()=="15万"){
		// 	san=999;
		// }else if($("#pei").text()=="20万"){
		// 	san=1087;
		// }else if(quota2=="30万"){
		// 	san=1226;
		// }else if(quota2=="50万"){
		// 	san=1472;
		// }else if(quota2=="100万"){
		// 	san=1917;
		// }else if(quota2=="200万"){
		// 	san=2133;
		// }
		$("#xieyi").next().children("input").attr("value",san);   //选中改变金额
		$("#xieyi").next().children("span").text(san);   //选中改变金额
		// $(element).attr("class","form-button form-common_button__1t6aZ active");   //选中当前元素
		// $("#pei").siblings().attr("class","form-button form-common_button__1t6aZ");   //取消选中当前元素
		priceAll();
		
	}
	
}
//onchange()
/* 详情隐藏 */
// function qiehuan(element){
// 	if($(element).children("div:eq(0)").css("display")=="none"){
// 		$(element).children("div:eq(0)").css("display","block");
// 		$(element).children("span").hide();
// 	}else{
// 		$(element).children("div:eq(0)").css("display","none");
// 		$(element).children("span").show();
// 	}
// 	// if($(element).next().css("display")=="none"){
// 	// 	$(element).next().show();
// 	// 	$(element).hide();
// 	// }
// }
function qiehuan2(element){
	// $(element).next().css("display","block");
	// $(element).hide();
		$(element).next().css("display","block");
		$(element).hide();
	
}
function close_all(element){
	$(element).parent().css("display","none");
	$(element).parent().prev().show();
}


